<?php 
class LoginController extends Controller{
	public function index(){
		if(IS_POST){
			$username=$_POST['username'];
			$password=$_POST['password'];
		
//			将提交数据与user表中比对
         $data=K('User')->where("account='{$username}' and password='{$password}'")->find();
		 if(!$data){
		 	$this->error("用户名或密码错误");
		 }
		 $this->success("登录成功",U("Index/index"));


		}
//		载入模板
		$this->display();
		
		
		
	}
	
}
	
	
	
	
	
	
	?>